﻿using System;

namespace HslCommunication.BasicFramework
{
	/// <summary>
	/// 系统版本类，由三部分组成，包含了一个大版本，小版本，修订版，还有一个开发者维护的内部版<br />
	/// System version class, consisting of three parts, including a major version, minor version, revised version, and an internal version maintained by the developer
	/// </summary>
	// Token: 0x020001A0 RID: 416
	[Serializable]
	public sealed class SystemVersion
	{
		/// <summary>
		/// 根据格式化字符串的版本号初始化，例如：1.0或1.0.0或1.0.0.0503<br />
		/// Initialize according to the version number of the formatted string, for example: 1.0 or 1.0.0 or 1.0.0.0503
		/// </summary>
		/// <param name="VersionString">格式化的字符串，例如：1.0或1.0.0或1.0.0.0503</param>
		// Token: 0x06002113 RID: 8467 RVA: 0x000A0DF8 File Offset: 0x0009EFF8
		public SystemVersion(string VersionString)
		{
			string[] array = VersionString.Split(new char[]
			{
				'.'
			}, StringSplitOptions.RemoveEmptyEntries);
			bool flag = array.Length >= 1;
			if (flag)
			{
				this.m_MainVersion = Convert.ToInt32(array[0]);
			}
			bool flag2 = array.Length >= 2;
			if (flag2)
			{
				this.m_SecondaryVersion = Convert.ToInt32(array[1]);
			}
			bool flag3 = array.Length >= 3;
			if (flag3)
			{
				this.m_EditVersion = Convert.ToInt32(array[2]);
			}
			bool flag4 = array.Length >= 4;
			if (flag4)
			{
				this.m_InnerVersion = Convert.ToInt32(array[3]);
			}
		}

		/// <summary>
		/// 根据指定的主版本，次版本，修订版来实例化一个对象<br />
		/// Instantiate an object based on the specified major, minor, and revision
		/// </summary>
		/// <param name="main">主版本</param>
		/// <param name="sec">次版本</param>
		/// <param name="edit">修订版</param>
		// Token: 0x06002114 RID: 8468 RVA: 0x000A0EAA File Offset: 0x0009F0AA
		public SystemVersion(int main, int sec, int edit)
		{
			this.m_MainVersion = main;
			this.m_SecondaryVersion = sec;
			this.m_EditVersion = edit;
		}

		/// <summary>
		/// 根据指定的主版本，次版本，修订版，内部版本来实例化一个对象<br />
		/// Instantiate an object based on the specified major, minor, revision, and build
		/// </summary>
		/// <param name="main">主版本</param>
		/// <param name="sec">次版本</param>
		/// <param name="edit">修订版</param>
		/// <param name="inner">内部版本号</param>
		// Token: 0x06002115 RID: 8469 RVA: 0x000A0EE8 File Offset: 0x0009F0E8
		public SystemVersion(int main, int sec, int edit, int inner)
		{
			this.m_MainVersion = main;
			this.m_SecondaryVersion = sec;
			this.m_EditVersion = edit;
			this.m_InnerVersion = inner;
		}

		/// <summary>
		/// 主版本
		/// </summary>
		// Token: 0x170006BD RID: 1725
		// (get) Token: 0x06002116 RID: 8470 RVA: 0x000A0F36 File Offset: 0x0009F136
		public int MainVersion
		{
			get
			{
				return this.m_MainVersion;
			}
		}

		/// <summary>
		/// 次版本
		/// </summary>
		// Token: 0x170006BE RID: 1726
		// (get) Token: 0x06002117 RID: 8471 RVA: 0x000A0F3E File Offset: 0x0009F13E
		public int SecondaryVersion
		{
			get
			{
				return this.m_SecondaryVersion;
			}
		}

		/// <summary>
		/// 修订版
		/// </summary>
		// Token: 0x170006BF RID: 1727
		// (get) Token: 0x06002118 RID: 8472 RVA: 0x000A0F46 File Offset: 0x0009F146
		public int EditVersion
		{
			get
			{
				return this.m_EditVersion;
			}
		}

		/// <summary>
		/// 内部版本号，或者是版本号表示为年月份+内部版本的表示方式
		/// </summary>
		// Token: 0x170006C0 RID: 1728
		// (get) Token: 0x06002119 RID: 8473 RVA: 0x000A0F4E File Offset: 0x0009F14E
		public int InnerVersion
		{
			get
			{
				return this.m_InnerVersion;
			}
		}

		/// <summary>
		/// 根据格式化为支持返回的不同信息的版本号<br />
		/// C返回1.0.0.0<br />
		/// N返回1.0.0<br />
		/// S返回1.0
		/// </summary>
		/// <param name="format">格式化信息</param>
		/// <returns>版本号信息</returns>
		// Token: 0x0600211A RID: 8474 RVA: 0x000A0F58 File Offset: 0x0009F158
		public string ToString(string format)
		{
			bool flag = format == "C";
			string result;
			if (flag)
			{
				result = string.Format("{0}.{1}.{2}.{3}", new object[]
				{
					this.MainVersion,
					this.SecondaryVersion,
					this.EditVersion,
					this.InnerVersion
				});
			}
			else
			{
				bool flag2 = format == "N";
				if (flag2)
				{
					result = string.Format("{0}.{1}.{2}", this.MainVersion, this.SecondaryVersion, this.EditVersion);
				}
				else
				{
					bool flag3 = format == "S";
					if (flag3)
					{
						result = string.Format("{0}.{1}", this.MainVersion, this.SecondaryVersion);
					}
					else
					{
						result = this.ToString();
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 获取版本号的字符串形式，如果内部版本号为0，则显示时不携带
		/// </summary>
		/// <returns>版本号信息</returns>
		// Token: 0x0600211B RID: 8475 RVA: 0x000A103C File Offset: 0x0009F23C
		public override string ToString()
		{
			bool flag = this.InnerVersion == 0;
			string result;
			if (flag)
			{
				result = this.ToString("N");
			}
			else
			{
				result = this.ToString("C");
			}
			return result;
		}

		/// <summary>
		/// 判断两个实例是否相等
		/// </summary>
		/// <param name="obj">版本号</param>
		/// <returns>是否一致</returns>
		// Token: 0x0600211C RID: 8476 RVA: 0x000A1078 File Offset: 0x0009F278
		public override bool Equals(object obj)
		{
			return base.Equals(obj);
		}

		/// <summary>
		/// 获取哈希值
		/// </summary>
		/// <returns>哈希值</returns>
		// Token: 0x0600211D RID: 8477 RVA: 0x000A1094 File Offset: 0x0009F294
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		/// <summary>
		/// 判断是否相等
		/// </summary>
		/// <param name="SV1">第一个版本</param>
		/// <param name="SV2">第二个版本</param>
		/// <returns>是否相同</returns>
		// Token: 0x0600211E RID: 8478 RVA: 0x000A10AC File Offset: 0x0009F2AC
		public static bool operator ==(SystemVersion SV1, SystemVersion SV2)
		{
			bool flag = SV1.MainVersion != SV2.MainVersion;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = SV1.SecondaryVersion != SV2.SecondaryVersion;
				if (flag2)
				{
					result = false;
				}
				else
				{
					bool flag3 = SV1.m_EditVersion != SV2.m_EditVersion;
					if (flag3)
					{
						result = false;
					}
					else
					{
						bool flag4 = SV1.InnerVersion != SV2.InnerVersion;
						result = !flag4;
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 判断是否不相等
		/// </summary>
		/// <param name="SV1">第一个版本号</param>
		/// <param name="SV2">第二个版本号</param>
		/// <returns>是否相同</returns>
		// Token: 0x0600211F RID: 8479 RVA: 0x000A112C File Offset: 0x0009F32C
		public static bool operator !=(SystemVersion SV1, SystemVersion SV2)
		{
			bool flag = SV1.MainVersion != SV2.MainVersion;
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool flag2 = SV1.SecondaryVersion != SV2.SecondaryVersion;
				if (flag2)
				{
					result = true;
				}
				else
				{
					bool flag3 = SV1.m_EditVersion != SV2.m_EditVersion;
					if (flag3)
					{
						result = true;
					}
					else
					{
						bool flag4 = SV1.InnerVersion != SV2.InnerVersion;
						result = flag4;
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 判断一个版本是否大于另一个版本
		/// </summary>
		/// <param name="SV1">第一个版本</param>
		/// <param name="SV2">第二个版本</param>
		/// <returns>是否相同</returns>
		// Token: 0x06002120 RID: 8480 RVA: 0x000A11AC File Offset: 0x0009F3AC
		public static bool operator >(SystemVersion SV1, SystemVersion SV2)
		{
			bool flag = SV1.MainVersion > SV2.MainVersion;
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool flag2 = SV1.MainVersion < SV2.MainVersion;
				if (flag2)
				{
					result = false;
				}
				else
				{
					bool flag3 = SV1.SecondaryVersion > SV2.SecondaryVersion;
					if (flag3)
					{
						result = true;
					}
					else
					{
						bool flag4 = SV1.SecondaryVersion < SV2.SecondaryVersion;
						if (flag4)
						{
							result = false;
						}
						else
						{
							bool flag5 = SV1.EditVersion > SV2.EditVersion;
							if (flag5)
							{
								result = true;
							}
							else
							{
								bool flag6 = SV1.EditVersion < SV2.EditVersion;
								if (flag6)
								{
									result = false;
								}
								else
								{
									bool flag7 = SV1.InnerVersion > SV2.InnerVersion;
									if (flag7)
									{
										result = true;
									}
									else
									{
										bool flag8 = SV1.InnerVersion < SV2.InnerVersion;
										result = (flag8 && false);
									}
								}
							}
						}
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 判断第一个版本是否小于第二个版本
		/// </summary>
		/// <param name="SV1">第一个版本号</param>
		/// <param name="SV2">第二个版本号</param>
		/// <returns>是否小于</returns>
		// Token: 0x06002121 RID: 8481 RVA: 0x000A128C File Offset: 0x0009F48C
		public static bool operator <(SystemVersion SV1, SystemVersion SV2)
		{
			bool flag = SV1.MainVersion < SV2.MainVersion;
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool flag2 = SV1.MainVersion > SV2.MainVersion;
				if (flag2)
				{
					result = false;
				}
				else
				{
					bool flag3 = SV1.SecondaryVersion < SV2.SecondaryVersion;
					if (flag3)
					{
						result = true;
					}
					else
					{
						bool flag4 = SV1.SecondaryVersion > SV2.SecondaryVersion;
						if (flag4)
						{
							result = false;
						}
						else
						{
							bool flag5 = SV1.EditVersion < SV2.EditVersion;
							if (flag5)
							{
								result = true;
							}
							else
							{
								bool flag6 = SV1.EditVersion > SV2.EditVersion;
								if (flag6)
								{
									result = false;
								}
								else
								{
									bool flag7 = SV1.InnerVersion < SV2.InnerVersion;
									if (flag7)
									{
										result = true;
									}
									else
									{
										bool flag8 = SV1.InnerVersion > SV2.InnerVersion;
										result = (flag8 && false);
									}
								}
							}
						}
					}
				}
			}
			return result;
		}

		// Token: 0x040007E3 RID: 2019
		private int m_MainVersion = 2;

		// Token: 0x040007E4 RID: 2020
		private int m_SecondaryVersion = 0;

		// Token: 0x040007E5 RID: 2021
		private int m_EditVersion = 0;

		// Token: 0x040007E6 RID: 2022
		private int m_InnerVersion = 0;
	}
}
